<template>
  <h1>行政区-树组件</h1>
  <f-region-tree v-model:value="dataValue" :level="4" allowClear class="w400" @change="changeData" />
  <pre>{{ dataValue }}</pre>
</template>

<script setup>
import { onBeforeMount, ref } from 'vue';

// const dataValue = ref(null);
// const dataValue = ref([]);
// const dataValue = ref(["130000000000", "130300000000", "130306000000", "130306001000"]);
const dataValue = ref({
  province: { regionCode: '130000000000' },
  region: { regionCode: '130300000000' },
  county: { regionCode: '130306000000' },
  township: { regionCode: '130306001000' },
  village: null,
  zipcode: null
});

const changeData = (value, item) => console.log('changeData', value, item);

onBeforeMount(() => {
  // setTimeout(() => {
  //   dataValue.value = {
  //     province: { regionCode: '210000000000' },
  //     region: { regionCode: '210600000000' },
  //   };
  // }, 1000 * 1.7);
});
</script>

<style lang="scss">

</style>
